<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
	<style>
		div{
			width: 20px;
			height: 20px;
			background: red;
			margin: 5px 5px;
			float: left;
		}
		input{
			display: block;
		}
	</style>
<body id="box">
    <!-- 
      点击一个按钮生成100DIV
     -->
     <input type="button" value="动起来!" onclick="demo(this.value)">
     <input type="button" value="消失吧!" onclick="demo(this.value)">
</body>
</html>

<script>
	function demo(value){
		var body = document.getElementById('box');
		var str = '<input type="button" value="动起来!" onclick="demo(this.value)"><input type="button" value="消失吧!" onclick="demo(this.value)">';
		if (value == '动起来!') {
			for (var i = 0; i < 100; i++) {
				str += '<div></div>'
				if (i == 99) {
				}
			}
		}
		
		body.innerHTML = str;
	}
</script>